//
//  BtBreadCumbViewController.m
//  myDemo2
//
//  Created by wuxueying on 14-4-18.
//
//

#import "BtBreadCumbViewController.h"
#import "BTBreadcrumbView.h"
#define mRGBA(_red,_green,_blue,_alpha) \
[UIColor colorWithRed:(_red/255.0) green:(_green/255.0) blue:(_blue/255.0) alpha:_alpha]

@interface BtBreadCumbViewController ()<BTBreadcrumbViewDelegate>
{
    BTBreadcrumbView * _breadcrumb;
}
@end
@implementation BtBreadCumbViewController

- (void)loadView
{
    [super loadView];
    self.view.backgroundColor = mRGBA(148, 248, 200, 1);
    
    _breadcrumb = [[BTBreadcrumbView alloc] initWithFrame:CGRectMake(20, 75, 0, 0)];
    _breadcrumb.delegate = self;
    [_breadcrumb sizeToFit];
    [self.view addSubview:_breadcrumb];
}


- (void)viewDidLoad
{
    [super viewDidLoad];
}

- (BTBreadcrumbItem *)item:(NSString *)title {
    BTBreadcrumbItem *item = [[BTBreadcrumbItem alloc] init];
    item.title = title;
    return item;
}


- (void)breadcrumbViewDidTapStartButton:(BTBreadcrumbView *)view
{
    [_breadcrumb setItems:[NSArray arrayWithObjects:
                           [self item:@"Level 1"], [self item:@"Level 2"], [self item:@"Level 3"], nil]
                 animated:YES];
}
- (void)breadcrumbView:(BTBreadcrumbView *)view didTapItemAtIndex:(NSUInteger)index
{
    NSLog(@"Item at Index = %d", index);
    [_breadcrumb setItems:[NSArray arrayWithObjects:nil]
                 animated:YES];
}
@end
